<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Class: ViewModels::PathStore
  
    &mdash; Documentation by YARD 0.8.3
  
</title>

  <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />

  <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  hasFrames = window.top.frames.main ? true : false;
  relpath = '../';
  framesUrl = "../frames.html#!" + escape(window.location.href);
</script>


  <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>


  </head>
  <body>
    <div id="header">
      <div id="menu">
  
    <a href="../_index.html">Index (P)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../ViewModels.html" title="ViewModels (module)">ViewModels</a></span></span>
     &raquo; 
    <span class="title">PathStore</span>
  

  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="../class_list.html">
      Class List
    </a>
  
    <a class="full_list_link" id="method_list_link"
        href="../method_list.html">
      Method List
    </a>
  
    <a class="full_list_link" id="file_list_link"
        href="../file_list.html">
      File List
    </a>
  
</div>
      <div class="clear"></div>
    </div>

    <iframe id="search_frame"></iframe>

    <div id="content"><h1>Class: ViewModels::PathStore
  
  
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName">Object</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">ViewModels::PathStore</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
  
    
  
  
  
    <dt class="r2 last">Defined in:</dt>
    <dd class="r2 last">lib/view_models/path_store.rb</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    
<p>A simple path store. Designed to remove a bit of complexity from the base
view model.</p>

<p>Use it to install an instance in the metaclass.</p>


  </div>
</div>
<div class="tags">
  

</div>



  <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
  <ul class="summary">
    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#view_model_class-instance_method" title="#view_model_class (instance method)">- (Object) <strong>view_model_class</strong> </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>The view model class attribute.</p>
</div></span>
  
</li>

    
  </ul>




  
    <h2>
      Class Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#install_in-class_method" title="install_in (class method)">+ (Object) <strong>install_in</strong>(klass) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Install in the metaclass (as an example).</p>
</div></span>
  
</li>

      
    </ul>
  
    <h2>
      Instance Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#%5B%5D-instance_method" title="#[] (instance method)">- (Object) <strong>[]</strong>(key) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Simple [] delegation.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#%5B%5D%3D-instance_method" title="#[]= (instance method)">- (Object) <strong>[]=</strong>(key, path) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Does not save values for nil keys.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#cached-instance_method" title="#cached (instance method)">- (Object) <strong>cached</strong>(options, &amp;block) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Cache the result of the rendering.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#initialize-instance_method" title="#initialize (instance method)">- (PathStore) <strong>initialize</strong>(view_model_class) </a>
    

    
  </span>
  
  
    <span class="note title constructor">constructor</span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Initialize the path store.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#prepare-instance_method" title="#prepare (instance method)">- (Object) <strong>prepare</strong>(key) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Prepare the key for the next storing procedure.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#save-instance_method" title="#save (instance method)">- (Object) <strong>save</strong>(options) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Saves the options for the prepared key.</p>
</div></span>
  
</li>

      
    </ul>
  

<div id="constructor_details" class="method_details_list">
  <h2>Constructor Details</h2>
  
    <div class="method_details first">
  <h3 class="signature first" id="initialize-instance_method">
  
    - (<tt><span class='object_link'><a href="" title="ViewModels::PathStore (class)">PathStore</a></span></tt>) <strong>initialize</strong>(view_model_class) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Initialize the path store</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>view_model_class</span>
      
      
        <span class='type'>(<tt>ViewModel</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>The view model class</p>
</div>
      
    </li>
  
</ul>


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


18
19
20
21</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/view_models/path_store.rb', line 18</span>

<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span> <span class='id identifier rubyid_view_model_class'>view_model_class</span>
  <span class='ivar'>@view_model_class</span> <span class='op'>=</span> <span class='id identifier rubyid_view_model_class'>view_model_class</span>
  <span class='ivar'>@name_path_mapping</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
  
</div>

  <div id="instance_attr_details" class="attr_details">
    <h2>Instance Attribute Details</h2>
    
      
      <span id=""></span>
      <div class="method_details first">
  <h3 class="signature first" id="view_model_class-instance_method">
  
    - (<tt>Object</tt>) <strong>view_model_class</strong>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>The view model class attribute</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


13
14
15</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/view_models/path_store.rb', line 13</span>

<span class='kw'>def</span> <span class='id identifier rubyid_view_model_class'>view_model_class</span>
  <span class='ivar'>@view_model_class</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>


  <div id="class_method_details" class="method_details_list">
    <h2>Class Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="install_in-class_method">
  
    + (<tt>Object</tt>) <strong>install_in</strong>(klass) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Install in the metaclass (as an example).</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


25
26
27</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/view_models/path_store.rb', line 25</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_install_in'>install_in</span> <span class='id identifier rubyid_klass'>klass</span>
  <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_path_store'>path_store</span> <span class='op'>=</span> <span class='const'>PathStore</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='id identifier rubyid_klass'>klass</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="[]-instance_method">
  
    - (<tt>Object</tt>) <strong>[]</strong>(key) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Simple [] delegation.</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


60
61
62</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/view_models/path_store.rb', line 60</span>

<span class='kw'>def</span> <span class='op'>[]</span> <span class='id identifier rubyid_key'>key</span>
  <span class='ivar'>@name_path_mapping</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="[]=-instance_method">
  
    - (<tt>Object</tt>) <strong>[]=</strong>(key, path) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Does not save values for nil keys.</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


53
54
55
56</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/view_models/path_store.rb', line 53</span>

<span class='kw'>def</span> <span class='op'>[]=</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span>
  <span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
  <span class='ivar'>@name_path_mapping</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='id identifier rubyid_path'>path</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="cached-instance_method">
  
    - (<tt>Object</tt>) <strong>cached</strong>(options, &amp;block) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Cache the result of the rendering.</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


31
32
33
34
35</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/view_models/path_store.rb', line 31</span>

<span class='kw'>def</span> <span class='id identifier rubyid_cached'>cached</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span>
  <span class='id identifier rubyid_prepare'>prepare</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_path_key'>path_key</span>
  <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span>
  <span class='id identifier rubyid_save'>save</span> <span class='id identifier rubyid_options'>options</span> <span class='kw'>and</span> <span class='id identifier rubyid_result'>result</span> <span class='kw'>if</span> <span class='id identifier rubyid_result'>result</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="prepare-instance_method">
  
    - (<tt>Object</tt>) <strong>prepare</strong>(key) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
  <div class="note notetag">
    <strong>Note:</strong>
    <div class='inline'>
<p>If this is nil, the store will not save the path.</p>
</div>
  </div>


<p>Prepare the key for the next storing procedure.</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


41
42
43</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/view_models/path_store.rb', line 41</span>

<span class='kw'>def</span> <span class='id identifier rubyid_prepare'>prepare</span> <span class='id identifier rubyid_key'>key</span>
  <span class='ivar'>@key</span> <span class='op'>=</span> <span class='id identifier rubyid_key'>key</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="save-instance_method">
  
    - (<tt>Object</tt>) <strong>save</strong>(options) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Saves the options for the prepared key.</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


47
48
49</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/view_models/path_store.rb', line 47</span>

<span class='kw'>def</span> <span class='id identifier rubyid_save'>save</span> <span class='id identifier rubyid_options'>options</span>
  <span class='kw'>self</span><span class='lbracket'>[</span><span class='ivar'>@key</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_file'>file</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

    <div id="footer">
  Generated on Tue Oct 16 23:27:35 2012 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.8.3 (ruby-1.9.3).
</div>

  </body>
</html>